const Koa = require("koa");
const Router = require("koa-router");
const Cors = require("@koa/cors");
const KoaBody = require("koa-body");

const app = new Koa();
const router = new Router();

app.use(KoaBody());
app.use(Cors());

router.post("/post", async (ctx) => {
  let { body } = ctx.request;
  ctx.body = {
    ...body,
  };
});

app.use(router.routes()).use(router.allowedMethods());
app.listen(3000);
